<template>
    <div class="todoFoot">
        <span>剩余: {{list.length}}</span>
        <div class="record" @click='fn'>
            <button @click="isSel ='all'" :class="{status:isSel==='all'}">全部</button>
            <button @click="isSel='yes'" :class="{status:isSel==='yes'}">已完成</button>
            <button @click="isSel='no'" :class="{status:isSel==='no'}">未完成</button>
        </div>  
        <button @click='delYes'>清除已完成</button>
    </div>
</template>

<script>
    export default {
        props:['list'],
        data(){
            return {
                // 默认选中 全部
                isSel:"all"
            }
        },
        methods:{
            fn(){
                // 点击全部、已完成、未完成
                // 传递 对应的 isSel
                this.$emit("changeType", this.isSel)
            },
            delYes(){
                // 点击清除 已完成任务清空
                this.$emit('clearEvent')
            }
        }
    }
</script>

<style scoped>
.todoFoot{
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #000;
    border-bottom: 2px solid #ccc;
    height: 50px;
    line-height: 50px;
}
span{
    /* margin-left: 10px; */
}
.record{
    display: flex;
    justify-content: space-between;
    width: 200px;
    height: 29px;
}

button{
    border: none;
    background-color: #fff;
    color: #000;
    line-height: 26px;
    font-size: 16px;

}

.status{
    border: 1px solid #000;
}
</style>